package com.spoj;


import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
import java.util.TimeZone;

public class CRYPTO1{
    
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        try {
            BigInteger divider = new BigInteger("4000000007");
            String in = input.next();
            BigInteger remainder = new BigInteger(in);
            //remainder.modPow((divider.add(BigInteger.ONE)).divide(BigInteger.valueOf(4)), divider); // 
            BigInteger result =  fex(remainder, (divider.add(BigInteger.ONE)).divide(BigInteger.valueOf(4)), divider);
            Date date = new Date(result.longValue() * 1000);
            
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            if (calendar.get(Calendar.YEAR) > 2030) {
                date = new Date((divider.longValue() - result.longValue()) * 1000);
            }
            SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
            formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
            String finalDate = formatter.format(date);
            System.out.print(finalDate);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            input.close();
        }
    }

    private static BigInteger fex(BigInteger x, BigInteger e, BigInteger m) {
        BigInteger y = BigInteger.ONE;
        BigInteger TWO = BigInteger.valueOf(2);
        while (!e.equals(BigInteger.ZERO)) {
            if (e.mod(TWO).equals(BigInteger.ZERO)) {
                x = x.multiply(x).mod(m);
                e = e.divide(TWO);
            } else {
                y = x.multiply(y).mod(m);
                e = e.subtract(BigInteger.ONE);
            }
        }
        return y;
    }
}

